import { CreateUINode, UINode } from "babylon-lib/gui/base/ui-node";
import { ANCHOR } from "babylon-lib/gui/control/abstract-base";
import { CreateUIRectangle } from "babylon-lib/gui/control/ui-rectangle";
import { AbstractMesh, Color3, Stage, Vector3 } from "babylon-lib/index";
import { RenderOrder } from "babylon-lib/misc/render-order";
import * as Data from '../data/data';
import { RawAssetsUrl } from "../raw-assets-info";
import { CreateUIImage } from "babylon-lib/gui/control/ui-image";
import { StandardMaterial } from "@babylonjs/core";


class AimMark {

    public static node: UINode;

    public static initialize(stage: Stage): void {
        this.initializeNode(stage);
        this.bindData(stage);
    }

    private static bindData(stage: Stage): void {
        const scope = AimMark;
    }

    private static initializeNode(stage: Stage): void {
        const aim = stage.loader(stage.mainScene).getTextureTaskInfo(RawAssetsUrl.textureAim)!.texture!;
        const node = CreateUINode('uav-mark-node', stage.mainScene, {
            anchor: new Vector3(0.5, 0.5, 0),
            lockToCamera: true,
        }, [
            CreateUIImage('uav-aim-mark', stage.mainScene, {
                anchor: ANCHOR.CENTER,
                width: 28,
                height: 28,
                url: aim.url!,
                inoperable: true,
                renderingGroupId: RenderOrder.id(Data.orders.sceneFront),
            }),
            CreateUIRectangle('uav-aim-point',stage.mainScene,{
                anchor:ANCHOR.CENTER,
                width:0.1,
                height:0.1,
                inoperable: true,
                background:'#ff0000',
                renderingGroupId: RenderOrder.id(Data.orders.sceneFront),
            }),
        ]);
        
        this.node = node;
    }

}


export { AimMark };